require(["common", "coAjax", "hash_routie"], function(jSouper, coAjax, hash_routie) {
	hash_routie.on("bina", function() {
		coAjax.get(appConfig.user.bina.all, function(result) {
			App.set("$Cache.user_bina.all", result.result);
		});
	});
	App.set("$Event.user_bina.未申请兑换_to_申请兑换中", function(e, vm) {
		if (!App.get("loginer.info.alipay")) {
			alert("warn", "您还未绑定支付宝账号，请到“个人信息”页进行设置，确保兑现顺利进行", 5000)
		}
		coAjax.put(appConfig.user.bina.未申请兑换_to_申请兑换中, {
			bus_id: vm.get("bus_id")
		}, function(result) {
			vm.set(result.result);
		});
	});
	App.set("$Event.user_bina.商家已付款_to_用户确认付款", function(e, vm) {
		coAjax.put(appConfig.user.bina.商家已付款_to_用户确认付款, {
			bus_id: vm.get("bus_id")
		}, function(result) {
			vm.set(result.result);
		});
	});
	App.set("$Event.user_bina.open_first_acc_users", function(e, vm) {
		vm.set("_show_first_acc_users", true);
		// if (!vm.get("first_acc_users")) {
		coAjax.get(appConfig.user.bina.first_acc_users + vm.get("bus_id"), function(result) {
			vm.set("first_acc_users", result.result);
		});
		// }
	});
	App.set("$Event.user_bina.close_first_acc_users", function(e, vm) {
		vm.set("_show_first_acc_users", false);
	});

	App.set("$Event.user_bina.bina_to_BusUser_money", function(e, vm) {
		myPrompt("请输入转现金额额度：", vm.get("can_apply_acc").toFixed(2), function(money) {
			coAjax.put(appConfig.user.bina.bina_to_BusUser_money, {
				bus_id: vm.get("bus_id"),
				money: money
			}, function(result) {
				vm.set(result.result);
			});
		});
	});
});